package com.tobeing.calendar.lib;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.renderscript.BaseObj;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * Created by ToBeing on 2017/10/13/013.
 */

public class CalendarDay extends TextView {
    private boolean mIsSelected = false;
    private Paint mPaint;

    public CalendarDay(Context context) {
        this(context, null);
    }

    public CalendarDay(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CalendarDay(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init(){
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setAntiAlias(true);
        mPaint.setColor(Color.RED);
    }

    public void setSelected(boolean isSelect){
        mIsSelected = isSelect;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if(mIsSelected){
            setTextColor(Color.RED);
//            canvas.translate(getWidth() / 2, getHeight() / 2);
//            canvas.drawCircle(0, 0, getWidth() / 2, mPaint);
        }
    }
}
